﻿namespace Rally_MvvmC.Exceptions
{
    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Text;
    using System.Threading.Tasks;

    public class Logger
    {
        public static void LogException(Exception exception, string applicationName = "Rally_MvvmC")
        {
            var context = System.Web.HttpContext.Current;
            if (context != null)
            {
                Elmah.ErrorSignal.FromCurrentContext().Raise(exception, context);
            }
            else
            {
                var errorLog = Elmah.ErrorLog.GetDefault(null);
                errorLog.Log(new Elmah.Error(exception));
                Elmah.ErrorSignal.FromCurrentContext().Raise(exception);
            }
        }
    }
}
